package Day22;

import Day03.Text;
import jdk.swing.interop.SwingInterOpUtils;

public class Text1 {
    public static void main(String[] args) {
       Person[] persons = new Person[5];
       persons[0] = new Person("jack",15);
       persons[1] = new Student("jane",18,56.9);
       persons[2] = new Student("tom",18,78.5);
       persons[3] = new Teacher("zhou",32,250000);
       persons[4] = new Teacher("xiao",54,50000);


       for(int i = 0; i < 5; i++){
           System.out.println(persons[i].say());
           if(persons[i] instanceof Student){
               Student student = (Student)persons[i];
               student.study();
           }else if(persons[i] instanceof Teacher){
               Teacher teacher = (Teacher)persons[i];
               teacher.teach();
           }else if(persons[i] instanceof Person){

           }else{
               System.out.println("你的类型有误，请自己检查一下");
           }
       }
    }
}






